﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace UI
{
    public partial class xgbmdx : Form
    {
        public xgbmdx()
        {
            InitializeComponent();
        }

        private void skinButton1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void skinButton2_Click(object sender, EventArgs e)
        {
            if (skinTextBox1.Text == "" || skinTextBox1.Text == null)
            {
                MessageBox.Show("您什么都没输入！");
                return;
            }
            if (UI.Global.isNumber(skinTextBox1.Text) == false)
            {
                MessageBox.Show("您没有输入数字！");
                return;
            }
            DataTable i = BLL.UserManager.SelectAllJob().Tables[0];
            int sy = skinComboBox1.SelectedIndex;
            int jobid=Convert.ToInt32(i.Rows[sy][0]);
            int t=Convert.ToInt32(skinTextBox1.Text);
            int r=BLL.UserManager.UpdateDx(jobid, t);
            if (r == 1)
            {
                MessageBox.Show("修改成功");
            }
            else {
                MessageBox.Show("修改失败");
                
            }


        }

        private void xgbmdx_Load(object sender, EventArgs e)
        {

        }

        private void skinComboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            Model.departjob jb = new Model.departjob();
            DataTable i = BLL.UserManager.SelectAllJob().Tables[0];

            jb.Dx = (int)i.Rows[skinComboBox1.SelectedIndex][3];
                skinTextBox1.Text = Convert.ToString(jb.Dx);
            }
        }
    
}
